{% extends "base.html" %}
{% comment 'header' %}
# This file is part of opentaps Smart Energy Applications Suite (SEAS).

# opentaps Smart Energy Applications Suite (SEAS) is free software:
# you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# opentaps Smart Energy Applications Suite (SEAS) is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.

# You should have received a copy of the GNU Lesser General Public License
# along with opentaps Smart Energy Applications Suite (SEAS).
# If not, see <https://www.gnu.org/licenses/>.
{% endcomment %}

{% load static %}

{% block title %}Model: {{ object.entity_id }}{% endblock %}

{% block content %}
<div class="container">

  {% include "core/_breadcrumbs.html" %}

  <div class="card mb-3">
    <div class="card-body">
      <h2 class="d-flex">
        Model {{ object.object_id }}
        {% block add_button %}
        <div class="ml-auto">
          <a href="{% url 'core:model_delete' object.entity_id %}" {% if not object.can_delete %} class="btn btn-secondary" {% else %} class="btn btn-danger" {% endif %} role="button" ><i class="fa fa-trash mr-2"></i> Delete</a>
          <a href="{% url 'core:model_duplicate' object.entity_id %}" class="btn btn-primary" role="button"><i class="fa fa-copy"></i> Duplicate</a>
          <a href="{% url 'core:model_create_for' object.entity_id %}" class="btn btn-primary" role="button"><i class="fa fa-plus"></i> Add Model</a>
        </div>
        {% endblock add_button %}
      </h2>
      {% block inner_content %}

      {% if tags_form and head_tags %}
        {% include "core/_head_tags.html" with form=tags_form items=head_tags %}
      {% endif %}

      {% if object.get_child_models %}
        <h5>Child Models</h5>
        <ul>
        {% for cm in object.get_child_models %}
          <li><a href="{{ cm.get_absolute_url }}">{{ cm.description|default:cm }}</a></li>
        {% endfor %}
        </ul>
      {% endif %}
      {% endblock inner_content %}
    </div>
  </div>

  {% if tags_form %}
    {% include "core/_tags.html" with form_title='Add Tag' form=tags_form items=tags %}
  {% endif %}

  {% if file_upload_form %}
    {% include "core/_upload.html" with form_title='Upload File' link_form_title='Add Link' form=file_upload_form items=files %}
  {% endif %}

  {% if notes_form %}
    {% include "core/_notes.html" with form_title='Add Note' form=notes_form items=notes %}
  {% endif %}

</div>
{% endblock content %}
